/**
 * 
 */
package br.com.ctm.advogadope.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.xml.bind.annotation.XmlRootElement;

import br.com.framework.persistencia.model.AuditedEntity;

/**
 * @author Cleber
 *
 */
@Entity
@Table(name = "PROCESSO")
@XmlRootElement
public class Processo extends AuditedEntity {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private String npu;
	
	/**
	 * 
	 */
	public Processo() {
	}
	
	@Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator="SEQ_PROCESSO")
	@SequenceGenerator(name="SEQ_PROCESSO", sequenceName="SEQ_PROCESSO", allocationSize=1, initialValue=0)
	@Column(name = "ID_PROCESSO")
	public Long getId() {
		return super.getId();
	}
	
	/**
	 * @return the npu
	 */
	@Column(name = "NPU", length = 255, nullable = false, unique = true)
	@NotNull(message = "{processo.npu.obrigatorio}")
	@Pattern(regexp = "\\d{13}[1-9]{1}[0-9]{2}\\d{4}", message = "{processo.npu.invalido}")
	public String getNpu() {
		return npu;
	}

	/**
	 * @param npu the login to set
	 */
	public void setNpu(String nome) {
		this.npu = nome;
	}
	
	public static void main(String[] args) {
		//0000466-38.2011.8.17.8124
		System.out.println("Valido: " + "00004663820118178124".matches("\\d{13}[1-9]{1}[0-9]{2}\\d{4}"));
	}

}
